import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {

            String[] s = sc.nextLine().trim().split("，");
            int len = s.length;
            int[] nums = new int[len];
            for (int i = 0; i < len; i++) {
                nums[i] = Integer.parseInt(s[i]);
            }
            System.out.println(longSubSequence(nums));
        }
    }

    public static int longSubSequence(int[] arr) {
        int len = arr.length;
        int[] f = new int[len];
        f[0] = 1;
        for (int i = 0; i < len; i++) {
            int temp = 0;
            for (int j = 0; j < i; j++) {
                if(arr[j] < arr[i] && temp < f[j]) {
                    temp = f[j];
                }
            }
            f[i] = temp + 1;
        }
        int res = 0;
        for (int i = 0; i < len; i++) {
            if (f[i] > res) {
                res = f[i];
            }
        }
        return res;
    }
}

